fix(translation): drop empty assistant messages in OpenAI Chat encoding - #379
fix(translation): drop empty assistant messages in OpenAI Chat encoding#379Pana wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
WalkthroughThe OpenAI Chat encoder now removes assistant messages with empty content when they have no tool calls. A regression test covers Anthropic assistant turns that contain only private thinking blocks. ChangesOpenAI Chat message filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
Signed-off-by: Pana <pana.wang@outlook.com>
b513d82 to
2eae3ea
Compare
|
@Pana Thanks for adding the fix. Can you please add the reproduction steps for the issue, and before the fix snapshot with error and after the fix snapshot. |
|
I used the moonshot platform API and key to start the switchyard server, and then switched the codex to the switchyard server's URL through the CC switch. When conversing with the same codex, I encountered the error: Invalid request: the message at position 5 with role 'assistant' must not be empty. |
What
Use this project with moonshot kimi-k3 model, will encounter error: Invalid request: the message at position 5 with role 'assistant' must not be empty
Why
So this PR is used to improve compatibility to kimi API
Closes #
How tested
uv run ruff check .cleanuv run mypy switchyardcleanuv run pytest tests/greenChecklist
snake_caseof the primary class.switchyard/__init__.py.__all__if intended for downstream use.--helpupdated if customer-facing surface changed.Signed-off-by: Your Name <email>) per the DCO.Notes for reviewers
Anything reviewers should pay extra attention to — risky paths, follow-up tickets, intentional trade-offs.
Summary by CodeRabbit